/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author KNO
 */
@Entity
@Table(name = "periodo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Periodo.findAll", query = "SELECT p FROM Periodo p"),
    @NamedQuery(name = "Periodo.findByPerPeriodo", query = "SELECT p FROM Periodo p WHERE p.perPeriodo = :perPeriodo"),
    @NamedQuery(name = "Periodo.findByPerWeb", query = "SELECT p FROM Periodo p WHERE p.perWeb = :perWeb"),
    @NamedQuery(name = "Periodo.findByPerLocal", query = "SELECT p FROM Periodo p WHERE p.perLocal = :perLocal")})
public class Periodo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "per_periodo")
    private String perPeriodo;
    @Basic(optional = false)
    @Column(name = "per_web")
    @Temporal(TemporalType.DATE)
    private Date perWeb;
    @Basic(optional = false)
    @Column(name = "per_local")
    @Temporal(TemporalType.DATE)
    private Date perLocal;
    @OneToMany(mappedBy = "cursoPeriodo")
    private List<Curso> cursoList;

    public Periodo() {
    }

    public Periodo(String perPeriodo) {
        this.perPeriodo = perPeriodo;
    }

    public Periodo(String perPeriodo, Date perWeb, Date perLocal) {
        this.perPeriodo = perPeriodo;
        this.perWeb = perWeb;
        this.perLocal = perLocal;
    }

    public String getPerPeriodo() {
        return perPeriodo;
    }

    public void setPerPeriodo(String perPeriodo) {
        this.perPeriodo = perPeriodo;
    }

    public Date getPerWeb() {
        return perWeb;
    }

    public void setPerWeb(Date perWeb) {
        this.perWeb = perWeb;
    }

    public Date getPerLocal() {
        return perLocal;
    }

    public void setPerLocal(Date perLocal) {
        this.perLocal = perLocal;
    }

    @XmlTransient
    public List<Curso> getCursoList() {
        return cursoList;
    }

    public void setCursoList(List<Curso> cursoList) {
        this.cursoList = cursoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (perPeriodo != null ? perPeriodo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Periodo)) {
            return false;
        }
        Periodo other = (Periodo) object;
        if ((this.perPeriodo == null && other.perPeriodo != null) || (this.perPeriodo != null && !this.perPeriodo.equals(other.perPeriodo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Periodo[ perPeriodo=" + perPeriodo + " ]";
    }
    
}
